package com.mzy.linear_struct.ks.动规;

import java.util.Arrays;

/**
 * @Author: mizy3
 * @Date: 2024/08/22/上午9:37
 * @Description:
 */
public class 最长递增子序列 {
    private int lengthOfLIS(int[] nums) {
        int[] dp = new int[nums.length];
        // dp[j] < dp[i] dp[j]表示j之前的最大连续组数组长度
        // if(nums[j] <= nums[i])
        // dp[i] = Math.max(dp[j] + 1, dp[i])

        Arrays.fill(dp, 1);

        for (int i = 1; i < dp.length; i++) {
            for (int j = 0; j < i; j++) {
                if (nums[j] <= nums[i]) {
                    dp[i] = Math.max(dp[j] + 1, dp[i]);
                }
            }
            System.out.println(i + "  " + dp[i]);
        }

        return 0;
    }
}























